//
//  CCBasicViewController.swift
//  SinaWebo
//
//  Created by 陶建 on 16/3/28.
//  Copyright © 2016年 taoJ. All rights reserved.
//
import UIKit

class CCBasicViewController: UITableViewController {
    
    // 是否登陆
    var isLoginFlag = true
    override func loadView() {
        // 根据是否登陆判断显示什么View
        isLoginFlag ? super.loadView() : (view = customView)
    }
    
    lazy var customView : CCLogoutView = {
        let customView = CCLogoutView()
        customView.backgroundColor = UIColor.whiteColor()
        customView.delegate = self
        return customView
    }()
}

extension CCBasicViewController: CCLogoutViewDelegate {
    // 未登录 点击左面注册按钮
    func logoutViewDidRegisterButton(registerButton: UIButton) {
        print("logoutViewDidRegisterButton")
        navigationController?.pushViewController(CCTempViewController(), animated: true)
    }
    
    // 未登录 点击右侧登陆按钮
    func logoutViewDidLoginButton(loginButton: UIButton) {
        presentViewController(CCTempViewController(), animated: true, completion: nil)
    }
}
